Efficient Algorithms to Rank and Unrank Permutations in Lexicographic Order
نویسنده
چکیده
We present uniform and non-uniform algorithms to rank and unrank permutations in lexicographic order. The uniform algorithms run in O(n log n) time and outperform Knuth’s ranking algorithm in all the experiments, and also the lineartime non-lexicographic algorithm of Myrvold-Ruskey for permutations up to size 128. The non-uniform algorithms generalize Korf-Schultze’s linear time algorithm yet require much less space.
منابع مشابه
Cool-lex order and k-ary Catalan structures
For any given k, the sequence of k-ary Catalan numbers, Ct,k = 1 kt+1 ( kt t ) , enumerates a number of combinatorial objects, including k-ary Dyck words of length n = kt and k-ary trees with t internal nodes. We show that these objects can be efficiently ordered using the same variation of lexicographic order known as cool-lex order. In particular, we provide loopless algorithms that generate ...
متن کاملPractical algorithms to rank necklaces, Lyndon words, and de Bruijn sequences
We present practical algorithms for ranking k-ary necklaces and Lyndon words of length n. The algorithms are based on simple counting techniques. By repeatedly applying the ranking algorithms, both necklaces and Lyndon words can be efficiently unranked. Then, explicit details are given to rank and unrank the length n substrings of the lexicographically smallest de Bruijn sequence of order n.
متن کاملObtaining a Unique Solution for the Cross Efficiency by Using the Lexicographic method
Cross efficiency is a method with the idea of peer evaluation instead of self-evaluation, and is used for evaluation and ranking Decision Making Units (DMUs) in Data Envelopment Analysis (DEA). Unlike most existing DEA ranking models which can only rank a subset of DMUs, for example non-efficient or extreme efficient DMUs, cross efficiency can rank all DMUs, even non-extreme ones. However, sinc...
متن کاملLinear-Time Ranking of Permutations
A lexicographic ranking function for the set of all permutations of n ordered symbols translates permutations to their ranks in the lexicographic order of all permutations. This is frequently used for indexing data structures by permutations. We present algorithms for computing both the ranking function and its inverse using O(n) arithmetic operations.
متن کاملConstant-memory Iterative Generation of Special Strings Representing Binary Trees
The shapes of binary trees can be encoded as permutations having a very special property. These permutations are tree permutations, or equivalently they avoid subwords of the type 231. The generation of binary trees in natural order corresponds to the generation of these special permutations in the lexicographic order. In this paper we use a stringologic approach to the generation of these spec...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2008